﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class 延迟跟随目标 : MonoBehaviour
{
    List<Vector3>  m_目标历史位置 = new List<Vector3>();
    public GameObject m_目标物体;

	void Start ()
    {
		
	}
	

	void Update ()
    {
        this.transform.position = m_目标物体.transform.position + new Vector3(0, 0, -0.2f);
    }

    private void FixedUpdate()
    {

        this.transform.position = m_目标物体.transform.position + new Vector3(0, 0, -0.2f);

        m_目标历史位置.Add(m_目标物体.transform.position);

        if (m_目标历史位置.Count == 2)
        {
           // this.transform.position = m_目标历史位置[1] + new Vector3(0,0,-0.2f);
            m_目标历史位置.Clear();
        }
    }
}
